﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/pages/Site.Master"
    CodeBehind="SowDelete.aspx.cs" Inherits="OnlineManagement.Web.pages.SowDelete" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script src="../resources/scripts/myAjax.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
        });

        function deleteAction() {
            var sowId = $("#<%=hfId.ClientID %>").val();
            var hogger = $("#<%=hfHogger.ClientID %>").val();
            var a = "<a href='SowManagement.aspx?id=" + hogger + "'>管理页面?</a>";
            $.ajax2({
                type: "post",
                contentType: "application/json",
                url: "../WebServices/Sows.asmx/DeleteSow",
                dataType: "json",
                data: "{ sowId: '" + sowId + "' }",
                success: function (data) {
                    if (data.d.Flag) {
                        $("#msg > div").remove();
                        var div = "<div class='notification success png_bg'> <a href='#' class='close'><img src='../resources/images/icons/cross_grey_small.png' title='关闭' alt='关闭' /></a><div id='back'>" + data.d.Message + " 返回 </div></div>";
                        $("#msg").append(div);
                        $("#back").append(a);
                    } else {
                        $("#msg > div").remove();
                        var div = "<div class='notification error png_bg'> <a href='#' class='close'><img src='../resources/images/icons/cross_grey_small.png' title='关闭' alt='关闭' /></a><div id='back'>" + data.d.Message + " 返回 </div></div>";
                        $("#msg").append(div);
                        $("#back").append(a);
                    }
                },
                error: function (error) {
                    $("#msg > div").remove();
                    var div = "<div class='notification error png_bg'> <a href='#' class='close'><img src='../resources/images/icons/cross_grey_small.png' title='关闭' alt='关闭' /></a><div id='back'>提交失败：" + error.status + " 返回 </div></div>";
                    $("#msg").append(div);
                    $("#back").append(a);
                }

            }, ".content-box-content");

         }

        function cancelAction() {
            var hogger = $("#<%=hfHogger.ClientID %>").val();
            window.location.href = "SowManagement.aspx?id="+hogger;
        }
        function checkEmpty() {
            var id = $("#<%=hfId.ClientID %>").val();
            alert(id);
            if (id == '') {
                $("#msg > div").remove();
                var span = "<div class='notification error png_bg'> <a href='#' class='close'><img src='../resources/images/icons/cross_grey_small.png' title='关闭' alt='关闭' /></a><div>删除信息为空，不能进行删除操作，请重新提交需要删除的信息。</div></div>";
                $("#msg").append(span);
                return false;
            }
            return true;
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="content-box-header">
        <h3>
            删除信息</h3>
        <div class="clear">
        </div>
    </div>
    <div class="content-box-content">
        <fieldset>
            <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
            <p>
                <span>
                    母猪耳号:</span>&nbsp;&nbsp;
                <asp:Label ID="lbBitID" runat="server"></asp:Label>
            </p>
            <p>
            <span>母猪品种</span>&nbsp;&nbsp;
            <asp:Label ID="lbType" runat="server"></asp:Label>
            </p>
            <p>
            <span>进场日期</span>&nbsp;&nbsp;
                <asp:Label ID="lbInFarmDate" runat="server"></asp:Label>
            </p>
            <p>
                <span>猪圈编号</span>&nbsp;
                <asp:Label ID="lbPigPenID" runat="server" Text="Label"></asp:Label>
            </p>
             <p>
              <input class="confirm-button" id="btnDelete" type="button" value="删除" onclick="deleteAction();" />
              <input class="confirm-button" id="btnCancel" type="button" value="取消" onclick="cancelAction()" />
             </p>
             <p></p>
             <p></p>
             <p>
                <div id="msg"></div>
             </p>
             <asp:HiddenField runat="server" ID="hfId" />
             <asp:HiddenField runat="server" ID="hfHogger" />
        </fieldset>
    </div>
</asp:Content>
